<template>
  <div>
    <div>Child</div>
    <p>{{ name }}</p>
    <p>{{ age }}</p>
    <button @click="handleClick">按钮</button>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "Child",
  props: {
    name: String,
    age: Number,
  },
  // 声明接受自定义事件
  emits: ["click"],
  methods: {
    handleClick() {
      this.$emit("click");
    },
  },
});
</script>

<style scoped></style>
